package com.meringer.beans;

import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import com.meringer.beans.ejb.StatsEJB;
import com.meringer.entities.Race;
import com.meringer.entities.RaceResult;

/**
 * JSF bean for the raceResults.xhtml page.
 * @author K.Zlatanov
 */
@ManagedBean(name="raceResultsBean")
@RequestScoped
public class RaceResultsBean
{
	@EJB
	private StatsEJB statsEJB;
	
	public RaceResultsBean() {
		
	}
	
	/**
	 * Gets the race standings for a given race. 
	 */
	public List<RaceResult> raceResults(Long raceID)
	{
		return statsEJB.getRaceResults(raceID);
	}
	
	public Race findRace(Long raceID)
	{
		return statsEJB.getRace(raceID);
	}
}
